﻿using System;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[RequireComponent(typeof(Button))]
public class UILoadSceneButton : MonoBehaviour
{
    private Button button;
    public string sceneName = "Title";

    private void Awake()
    {
        this.button = base.GetComponent<Button>();
        this.button.onClick.AddListener(delegate {
            if (!ScreenFader.isFading)
            {
                ScreenFader.Fade(() => SceneManager.LoadSceneAsync(this.sceneName));
            }
        });
    }
}

